package com.kefu.sys.vo;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.common.vo.AbstractSearchVo;
import com.kefu.sys.model.CdrRghistoryTenant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "消耗统计查询")
public class SysTenantConsumptionsVo extends AbstractSearchVo {
    @ApiModelProperty("账单类型：1=消耗，2=充值")
    private Integer type;
    @ApiModelProperty(value = "公司id")
    private String tenantId;


    @Override
    public LambdaQueryWrapper<CdrRghistoryTenant> lambdaQuery() {
        LambdaQueryWrapper<CdrRghistoryTenant> wrapper = Wrappers.lambdaQuery(CdrRghistoryTenant.class);
        if (type != null) {
            wrapper.eq(CdrRghistoryTenant::getType, type);
        }
        wrapper.eq(CdrRghistoryTenant::getTenantId, tenantId);
        wrapper.orderByDesc(CdrRghistoryTenant::getCreateTime);
        return wrapper;
    }
}

